{% extends "base.html" %}
{% block content %}
<div class="container mt-4">
    <h2>新建沟通纪要</h2>
    <div class="card">
        <div class="card-body">
            <form method="POST">
                <div class="row mb-3">
                    <div class="col-md-6">
                        <label class="form-label">会议时间</label>
                        <input type="datetime-local" class="form-control" name="meeting_time" required>
                    </div>
                    <div class="col-md-6">
                        <label class="form-label">地点</label>
                        <input type="text" class="form-control" name="location">
                    </div>
                </div>
                
                <div class="row mb-3">
                    <div class="col-md-6">
                        <label class="form-label">部门</label>
                        <input type="text" class="form-control" name="department" required>
                    </div>
                    <div class="col-md-6">
                        <label class="form-label">记录人</label>
                        <input type="text" class="form-control" name="recorder" required>
                    </div>
                </div>
                
                <div class="row mb-3">
                    <div class="col-md-6">
                        <label class="form-label">提出人</label>
                        <input type="text" class="form-control" name="proposer">
                    </div>
                    <div class="col-md-6">
                        <label class="form-label">方式</label>
                        <select class="form-select" name="method">
                            <option value="会议">会议</option>
                            <option value="邮件">邮件</option>
                            <option value="电话">电话</option>
                            <option value="即时通讯">即时通讯</option>
                        </select>
                    </div>
                </div>
                
                <div class="mb-3">
                    <label class="form-label">沟通纪要内容</label>
                    <textarea class="form-control" name="content" rows="4" required></textarea>
                </div>
                
                <div class="row mb-3">
                    <div class="col-md-6">
                        <label class="form-label">关联需求</label>
                        <select class="form-select" name="related_req_id">
                            <option value="">-- 选择关联需求 --</option>
                            {% for req in requirements %}
                            <option value="{{ req.req_id }}">{{ req.req_id }} - {{ req.description|truncate(30) }}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="col-md-6">
                        <label class="form-label">L3价值流推荐</label>
                        <select class="form-select" name="l3_value_stream">
                            <option value="">-- 选择价值流 --</option>
                            {% for node in l3_nodes %}
                            <option value="{{ node.node_id }}">{{ node.name }} ({{ node.code }})</option>
                            {% endfor %}
                        </select>
                    </div>
                </div>
                
                <div class="mb-3">
                    <label class="form-label">行动项</label>
                    <textarea class="form-control" name="action_items" rows="2" 
                              placeholder="每行一个行动项，格式：负责人@任务描述@截止日期"></textarea>
                    <div class="form-text">格式：负责人@任务描述@截止日期(YYYY-MM-DD)</div>
                </div>
                
                <div class="mb-3">
                    <label class="form-label">备注</label>
                    <textarea class="form-control" name="notes" rows="2"></textarea>
                </div>
                
                <button type="submit" class="btn btn-primary">保存</button>
                <a href="{{ url_for('communication.index') }}" class="btn btn-secondary">取消</a>
            </form>
        </div>
    </div>
</div>
{% endblock %}